package com.autologistics.dao;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.autologistics.model.Goodskind;

public class GoodskindDaoImpl implements GoodskindDao{
	private HibernateTemplate goodskindHibTemplate;
	
	
	public HibernateTemplate getGoodskindHibTemplate() {
		return goodskindHibTemplate;
	}


	public void setGoodskindHibTemplate(HibernateTemplate goodskindHibTemplate) {
		this.goodskindHibTemplate = goodskindHibTemplate;
	}


	public List<Goodskind> listAll(){
		System.out.println("goodkindDaoImpl:listAll");
		String hql="from Goodskind";
		
		List<Goodskind> goodskindList=goodskindHibTemplate.find(hql);
		if(goodskindList!=null&&goodskindList.size()>=0){
			return goodskindList;
		}else{
			return null;
		}
	}
	public Goodskind getById(int goodskindId){
		String hql="from Goodskind where id=?";
		List<Goodskind> goodskindList=goodskindHibTemplate.find(hql,goodskindId);
		Goodskind goodskind=goodskindList.get(0);
		if(goodskind==null){
			return null;
		}else{
			return goodskind;
		}
	}

}
